package com.example.demo.service;

import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/*
 * @Author:大力王
 * @Date:2024/6/13-13-22:39
 * 开始了
 */
@EqualsAndHashCode(callSuper = true)
@Service
@Slf4j
public class WeixinMaService extends WxMaServiceImpl {
    String appid = "wxb2a934df035a6d90";

    String secret = "3ce0e88a98dd58b9967f6de6ae9e7d7a";
    @PostConstruct
    public void init(){
        log.info("appid{}:",appid);
        final WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
        // 设置微信公众号的appid
        config.setAppid(appid);
        // 设置微信公众号的app corpSecret
        config.setSecret(secret);
        super.setWxMaConfig(config);
    }
}
